<template>
  <div
    v-show="loading"
    v-loading="loading"
    class="custom-loading-svg"
    element-loading-text="Loading..."
    element-loading-svg-view-box="-10, -10, 50, 50"
    :element-loading-svg="svg"
  ></div>
</template>

<script setup lang="ts">
// 全局加载组件
const props = withDefaults(
  defineProps<{
    loading: boolean;
  }>(),
  {
    loading: false,
  }
);
// 加载图标
const svg = `
        <path class="path" d="
          M 30 15
          L 28 17
          M 25.61 25.61
          A 15 15, 0, 0, 1, 15 30
          A 15 15, 0, 1, 1, 27.99 7.5
          L 15 15
        " style="stroke-width: 4px; fill: rgba(0, 0, 0, 0)"/>
      `;
</script>

<style>
.custom-loading-svg {
  display: flex;
  width: calc(100% - 20px);
  justify-content: center;
  height: calc(100vh - 128px);
  position: absolute;
  z-index: 999;
}
</style>
